home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2004 August / The Sunday Times - The Month 2004-08.iso / pc / engine / swf / dialogs.swf / scripts / frame_1 / DoAction_2.as next >
Encoding:
Text File  |  2004-03-31  |  1.6 KB  |  73 lines

  1. XML.prototype.ignoreWhite = true;
  2. XMLNode.prototype.byID = function(id)
  3. {
  4.    var _loc3_ = this.childNodes.length;
  5.    var _loc1_ = 0;
  6.    while(_loc1_ < _loc3_)
  7.    {
  8.       var _loc2_ = this.childNodes[_loc1_];
  9.       if(_loc2_.attributes.id == id)
  10.       {
  11.          return _loc2_;
  12.       }
  13.       _loc1_ = _loc1_ + 1;
  14.    }
  15.    return null;
  16. };
  17. XMLNode.prototype.byName = function(name)
  18. {
  19.    var _loc3_ = this.childNodes.length;
  20.    var _loc1_ = 0;
  21.    while(_loc1_ < _loc3_)
  22.    {
  23.       var _loc2_ = this.childNodes[_loc1_];
  24.       if(_loc2_.nodeName == name)
  25.       {
  26.          return _loc2_;
  27.       }
  28.       _loc1_ = _loc1_ + 1;
  29.    }
  30.    return null;
  31. };
  32. XMLNode.prototype.byIndex = function(index)
  33. {
  34.    if(this.childNodes[index])
  35.    {
  36.       return this.childNodes[index];
  37.    }
  38.    return null;
  39. };
  40. XMLNode.prototype.getText = function()
  41. {
  42.    return this.firstChild.nodeValue;
  43. };
  44. XMLNode.prototype.byPath = function(path)
  45. {
  46.    var _loc1_ = this;
  47.    var arrPath = path.split("/");
  48.    var len = arrPath.length;
  49.    var _loc3_ = 0;
  50.    while(_loc3_ < len)
  51.    {
  52.       var _loc2_ = arrPath[_loc3_];
  53.       if(_loc2_.charAt(0) == "@")
  54.       {
  55.          _loc1_ = _loc1_.byID(_loc2_.substring(1));
  56.       }
  57.       else if(_loc2_.charAt(0) == "#")
  58.       {
  59.          _loc1_ = _loc1_.byIndex(parseInt(_loc2_.substring(1)));
  60.       }
  61.       else
  62.       {
  63.          _loc1_ = _loc1_.byName(_loc2_);
  64.       }
  65.       if(!_loc1_)
  66.       {
  67.       }
  68.       _loc3_ = _loc3_ + 1;
  69.    }
  70.    return _loc1_;
  71. };
  72. ASSetPropFlags(XML.prototype,"byID,byName,byIndex,byPath,getText",1);
  73.